// 要压缩的JS
const fileName = 'fileSubmit.js';
const regex = new RegExp(`<script\\s+.*?src=".*?/${fileName}"><\\/script>`, 'gi');

const html = '<script type="text/javascript" src="js/fileSubmit.js"></script>';

const match = html.match(regex);
if (match) {
    console.log(match[0]); // 匹配到的整个 <script> 标签及其内容
} else {
    console.log('未找到匹配项');
}
